package com.monitor.controller.api;

import com.alibaba.fastjson.JSON;
import com.monitor.common.response.Result;
import com.monitor.controller.BaseController;
import com.monitor.service.MonitorService;
import com.monitor.vo.MonitorReqVo;
import com.monitor.vo.MonitorRetVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.lang.reflect.Method;

/**
 * @ClassName ApiMonitorController
 * @Package com.monitor.controller.api
 * @Description 监控api接口
 * @Author zhixingbai
 * @Create 2018/10/1113:53
 */
@RestController
@RequestMapping("/api/monitor")
public class ApiMonitorController extends BaseController {

    @Autowired
    private MonitorService monitorService;

    @RequestMapping(value = "/req",method = RequestMethod.POST,produces={"application/json;charset=UTF-8"} )
    public Result req(@Valid @RequestBody MonitorReqVo[] reqVo) {
        logger.info("明细查询请求参数:{}", JSON.toJSONString(reqVo));
        return monitorService.reqMonitor(reqVo);
    }

    @RequestMapping(value = "/ret",method = RequestMethod.POST,produces={"application/json;charset=UTF-8"})
    public Result ret(@Valid @RequestBody MonitorRetVo retVo)
    {
        logger.info("明细查询返回请求参数:{}", JSON.toJSONString(retVo));
        return monitorService.retMonitor(retVo);
    }
}
